home *** CD-ROM | disk | FTP | other *** search
- /*
- File: HshTbl.h
-
- Contains: AEHshTbl.h from C version of Apple Event Manager.
-
- Owned by: Jon Pugh
-
- Copyright: © 1993 - 1995 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #ifndef __HshTbl__
- #define __HshTbl__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- // defines used in this code
- #define HUNLOCK(aHdl) HUnlock((Handle)aHdl)
- #define HLOCK(aHdl) HLock((Handle)aHdl)
- #define SETNOPURGE(aHdl) HNoPurge(aHdl)
- #define NEWHANDLE(size) NewHandleClear(size)
- #define NEWHANDLESYS(size) NewHandleSys(size)
- #define NEWHANDLESYSCLEAR(size) NewHandleSysClear(size)
- #define HANDTOHAND(handPtr) HandToHand((Handle *)handPtr)
- #define GETHANDLESIZE(aHdl) GetHandleSize((Handle)aHdl)
- #define SETHANDLESIZE(aHdl, newSize) SetHandleSize((Handle)aHdl , newSize)
- #define DISPOSEHANDLE(aHdl) DisposeHandle((Handle)aHdl)
- #define DISPOSEPTR(p) DisposePtr(p)
- #define BLOCKMOVE(src,dst,count) BlockMove(src, dst, count)
- #define DEREF_OF(aHdl) *(Handle)aHdl
- #define CLEAR_REF_OF(aHdl) // no need to do anything on Mac
- #define MACMEMFLAGS(flags) SignedByte flags
- #define GETSTATE(myHndl) HGetState((Handle)myHndl)
- #define RESET_HANDLE(myHndl,flags) HSetState((Handle)myHndl,flags)
- #define MEMERROR() MemError()
-
- // error numbers
-
- #define ErrAlreadyExists -1722 // fix this constant
- #define ErrNotFound -1723 // fix this constant
- #define ErrEndOfTable -1724 // fix this constant
- #define ErrNoHashTable -1725 // used by NewHashTable
-
- typedef Handle HHand;
- typedef Ptr HEntryPtr;
- typedef Ptr KeyPtr;
- // typedef ProcPtr HashProc;
-
- typedef struct MemProcBlock * MemProcs; // ******** 11/16 IS THIS USED??????
-
- #if defined(powerc) || defined (__powerc)
- #pragma options align=mac68k
- #endif
- typedef struct MemProcBlock {
- UniversalProcPtr DerefProc;
- UniversalProcPtr NewProc;
- UniversalProcPtr GrowProc;
- UniversalProcPtr DisposeProc;
- } MemProcBlock;
-
- typedef struct HashInfo {
- long usedEntries;
- long collidedEntries;
- long totalEntries;
- long tableSize;
- } HashInfo;
- #if defined(powerc) || defined(__powerc)
- #pragma options align=reset
- #endif
-
- #if defined(powerc) || defined (__powerc)
- #pragma options align=mac68k
- #endif
- typedef struct KeyRec {
- OSType secondKey;
- OSType firstKey;
- }KeyRec;
- #if defined(powerc) || defined (__powerc)
- #pragma options align=reset
- #endif
-
- typedef KeyRec * KeyRecPtr;
-
- #if defined(powerc) || defined (__powerc)
- #pragma options align=mac68k
- #endif
- typedef struct handlerRec {
- long theRefCon;
- UniversalProcPtr theProc; // can be AEEventHandlerUPP or AECoerceDescUPP
- Boolean IsSpecial;
- } handlerRec;
- #if defined(powerc) || defined (__powerc)
- #pragma options align=reset
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- OSErr NewHashTable(long NumEntries, short KeySize,short ValueSize,
- MemProcs MemHooks,
- Boolean SysHeap,
- HHand * Table );
-
- OSErr DisposeHashTable(HHand *Hash, MemProcs MemHooks);
- OSErr ReplaceEntry(HHand Hash,MemProcs MemHooks,KeyPtr Key,HEntryPtr Value);
- OSErr RemoveKeyEntry(HHand Hash, MemProcs MemHooks,KeyPtr Key);
- OSErr GetKeyValue(HHand Hash, MemProcs MemHooks,KeyPtr Key,HEntryPtr Value);
- OSErr GetIndexedEntry(HHand Hash, MemProcs MemHooks, long Index, KeyPtr Key, HEntryPtr Value);
- Boolean CheckKey(HHand Hash, MemProcs MemHooks,KeyPtr Key);
-
-
- /* The following function is not implemented by AEHshTbl.C...but could just pass through to
- * ReplaceEntry.
- *
- *
- OSErr AddKeyEntry(HHand Hash, MemProcs MemHooks,KeyPtr Key,HEntryPtr Value);
- *
- *
- *
- */
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __HshTbl__ */